package member_coupon

import (
	// "bp/cache"
	sqlc "bp/db/sqlc"
	"bp/internal/util"
)

func (s *MemberCouponEntityServiceImp) ConvToCouponIDs(i interface{}) []int64 {
	return util.MapToInt64(util.ToGenericSlice(i), func(v interface{}) int64 {
		switch t := v.(type) {
		case *sqlc.MemberCoupon:
			return t.CouponID
		}
		return 0
	})
}

func (s *MemberCouponEntityServiceImp) MapMemberCouponEntityToPtr(list []sqlc.MemberCoupon) []*sqlc.MemberCoupon {
	ptrs := make([]*sqlc.MemberCoupon, len(list))
	for i := range list {
		ptrs[i] = &list[i]
	}
	return ptrs
}
